//
// Created by Mzoro on 2022/4/2.
//

#include <stdio.h>
#include <string.h>
#include <strings.h>

#define prtf(ex)   printf(#ex" :%s\n",ex)

/**
 * 将字符串 t 拼接到 s 尾
 * @param s
 * @param t
 */
void concat(char *s, char *t);
/**
 * 将字符串 t 复制到 s
 * @param s
 * @param t
 */
void cpy(char *s, char *t);
int main(){
    char a[] = "My name is Tony.";
    char b[] = "What's your name?";
    concat(a, b);
    prtf(a);
    return 0;
}

void concat(char *s, char *t){
    // 指针位置移动到最后
    while (*s++ != '\0') {

    }
    s--;
    // 将t 复制到s的尾
    cpy(s, t);
}
void cpy(char *s, char *t){
    while (*s++ = *t++)
        ;
}